package com.sm.service;

import com.github.pagehelper.PageHelper;
import com.sm.dao.HappySolveMapper;
import com.sm.model.HappySolve;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class HappySolveService {

    @Autowired
    private HappySolveMapper happySolveMapper;

    /**
     * 回答问题
     * @param happySovle
     * @return
     */
    public int insertSolve(HappySolve happySovle){
        int i = happySolveMapper.insertSolve(happySovle);
        return i;
    }

    /**
     * 幸福问答--回复详情部分
     * @param requestId
     * @return
     */
    public HappySolve selectSolveByReqeustId(Integer requestId){
        HappySolve happySolve = happySolveMapper.selectSolveByReqeustId(requestId);
        return happySolve;
    }

    /**
     *  更改点赞数量等
     */
    public int updateLikeNum(HappySolve happySolve){
        return happySolveMapper.updateSelective(happySolve);
    }

    /**
     * 根据id查询
     */
    public HappySolve selectOne(Integer id){
        return happySolveMapper.selectOne(id);
    }

    /**
     * 根据问题的id，查询幸福问答回答的内容
     */
    public HappySolve selectOneContent(Integer id){
        return happySolveMapper.selectOneContent(id);
    }
}
